home *** CD-ROM | disk | FTP | other *** search
- |---------------B A T C H L R N H E L P S Y S T E M-----------------|
- |command: SHIFT |
- |use: The SHIFT command lets your batch file access more than 10 |
- | replaceable parameters. |
- | |
- |example:The SHIFT command is illustrated by this example: |
- | [the lines below are as they would appear in a batch file] |
- | If %0 = "bak" |
- | %1 = "mine" |
- | %2 = "yours" |
- | %3...%9 are empty |
- | then a SHIFT (command) results in the following: |
- | %0 = "bak" |
- | %1 = "yours" |
- | %2...%9 are empty ["mine" has been "shifted" out] |
- | If you are still confused review the PARAM.HLP file. |
- | |
- |NOTES:DOS allows 10 parameters (%0-%9) to be used by a batch file. |
- | SHIFT allows you to move more parameters into a queue, discarding |
- | the first parameter. When you are listing parameters at the prompt, |
- | additional parameters (more than 10) should be on the same command |
- | line in order to be shifted into the queue.The single cmd.is SHIFT. |
- | When that subcommand is encountered, all parameter/marker pairings |
- | are shifted one to the left. Whatever was assigned to %0 is lost, |
- | the contents of %1 are moved to %0, %2 moves to %1... %9 moves to |
- | %8 and a new parameter from the command line is moved into %9. |
- | While this brings in a new parameter, all have shifted and you must |
- | anticipate the effect on your batch file "program". |
- | The effect of SHIFT: |
- | %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 |
- | | Remember, this command seems very simple, but its effects |
- | | are far ranging and the logical consequence of mis-matching |
- | | parameters and markers can be disastrous! |
- | | |
- | Lost |
- | |
- | MORE ABOUT THE SHIFT SUBCOMMAND: |
- | The SHIFT subcommand is made to be used with replaceable parameters.|
- | In the PARAM.HLP file there is an example for you to create called |
- | SEEFILE.BAT which shows you how to display three files you call up. |
- | What if you wanted to display four files? You would have to rewrite |
- | the batch file to include another TYPE command, or you could use |
- | the SHIFT command for more than 10 parameters in a file. The |
- | following batch file uses the GOTO and SHIFT command to ECHO any |
- | number of parameters typed on the command line. |
- | (you should create this file) |
- | COPY CON:REVEAL.BAT |
- | ECHO OFF |
- | CLS |
- | :LOOP |
- | CLS |
- | TYPE %1 | MORE |
- | SHIFT |
- | GOTO LOOP |
- | <F6> or <Ctrl Z> <Return> |
- | To execute type: REVEAL <FILENAME.EXT> <FILENAME.EXT>,ETC.,ETC. |
- | |
- | CAUTION:When this file runs out of parameters you will get a message|
- | "invalid number of parameters". It will then KEEP REPEATING until |
- | YOU STOP IT with a Ctrl C or Ctrl-Break! The file can only "read" |
- | the number of parameters you put on the prompt or command line. |
- | NOTE: the MORE command is to assure that if a text file (that is |
- | the only kind you can display with TYPE) is more than 24 lines, a |
- | pause will be inserted. Wildcards cannot be used with the command. |
- | |
- |----------------- T I M E M A S T E R ---------------------|